#include <bits/stdc++.h>
using namespace std;

int main() {
    vector<int> v = {1,2,3,10,10,10,4,3,7,1};
    // move certain elem into first of vector
    auto diffusion = stable_partition(v.begin(), v.end(), [&](int a){if(a < 3) return true; else return false;});
    auto it = v.begin();
    for(; it != v.end(); ++it) {
        cout << *it << endl;
    }
    cout << endl;
    auto compare = [&](int a, int b){return a > b;};
    sort(diffusion, v.end(), compare);
    it = v.begin();
    for(; it != v.end(); ++it) {
        cout << *it << endl;
    }
}